﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true"
    CodeBehind="ContractsManagement.aspx.cs" Inherits="QLHD.ContractsManagement" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    <%--<script language="javascript" type="text/javascript" src="Scripts/ContractManagement.js"></script>--%>
    <script language="javascript" type="text/javascript" src="/Scripts/gridcolumn-control.js"></script>
    <script language="javascript" type="text/javascript" src="/Scripts/ContractGrid.js?v=01"></script>
    <style type="text/css">
        .k-grid-AddKCP
        {
        	display:none;
        }
        .ct-root .k-grid-AddKCP
        {
        	display:block;
        }
    </style>
    <script>
        mnggridid = "grid";
        contractpermistion = parseInt('<%=userpermistion %>');
        var loadtype = '<%=Request.Params["_ct"] %>';
    </script>
    <script type="text/x-kendo-template" id="contractmngtemplate">    
        <div class="toolbar">
            <div class="filter">
                <input class="k-input" placeholder="Từ khóa" type="search" id="txtAdress"></input>
                <div class="advance-filter-item" style="float:left;">
                    <input class="k-input" placeholder="Số HĐ" type="search" id="txtSoHD" style="width:100px;"></input>
                    <input class="k-input" placeholder="Đối tác" type="search" id="txtDoitac"></input>
                    <input  placeholder="Từ ngày"  id="txtfromdate"></input>
                    <input  placeholder="Đến ngày"  id="txttodate"></input>
                    <input  placeholder="Chọn phòng"  id="drphong" style="width:150px"></input>
                </div>
                <a class="k-button k-search-button">Tìm kiếm</a>
            </div>
            <div class="left" style="line-height:30px; margin-left:10px; font-weight:bold;"><a href="javascript:void(0);" id="btnadvance">Tìm kiếm nâng cao ▶</a></div>
            <% if(!string.IsNullOrEmpty(userpermistion) &&  int.Parse(userpermistion)>=3) {%>
            <div class="function-button" style="float:left; margin-left:50px;">
                <a class="k-button k-button-icontext k-grid-add"><span class="k-icon k-add"></span>Thêm hợp đồng</a>
                <a class="k-button k-button-icontext k-grid-save-changes"><span class="k-icon k-update"></span>Lưu</a>
                <a class="k-button k-button-icontext k-grid-cancel-changes"><span class="k-icon k-cancel"></span>Hủy thay đổi</a>
            </div>
            <%} %>
            <div class="clear"></div>
        </div>
        <kendo:grid-column-command>
            <kendo:grid-column-commandItem name="delete" text="Xóa" click="Delete"/>
            <kendo:grid-column-commandItem name="Detail" text="Chi tiết" click="ViewDetail"/>
            <kendo:grid-column-commandItem name="AddKCP" text="Thêm KCP" click="AddKCP"/>
        </kendo:grid-column-command>
    </script>
    <script type="text/javascript" language="javascript">
        $().ready(function () {
            $("#grid").InitialContractGrid({ contractpermistion: contractpermistion, ParentID: 0, contracttype: 0, loadtype: loadtype, contractmngtemplate: $("#contractmngtemplate") });
            $("#btnadvance").click(function () {
                var filter = $(this).parent().parent().children(".filter");
                var advs = $(filter).children(".advance-filter-item");
                if (advs.css("display") != "undefined" && advs.css("display") == "block") {
                    $(advs).hide();
                    $(filter).removeClass("advance-filter");
                    $(this).text("Tìm kiếm nâng cao ▶");
                } else {
                    $(advs).show();
                    $(filter).addClass("advance-filter");
                    $(this).text("◄ Ẩn");
                }
            });

            $("#txtfromdate, #txttodate").kendoDatePicker({
                format: "dd/MM/yyyy"
            });

            $("#txtDoitac").kendoAutoComplete({
                dataSource: partners,
                filter: "contains",
                placeholder: "Chọn đối tác",
                separator: ", ",
                highlightFirst: true
            });

            //            $("#drphong").kendoDropDownList({
            //                dataTextField: "Ten",
            //                dataValueField: "ID",
            //                dataSource: departmentss
            //            });

            
            $("#drphong").kendoComboBox({
                dataTextField: "Ten",
                dataValueField: "ID",
                dataSource: departmentss,
                filter: "contains",
                suggest: true
            });
        });
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="SidebarContent" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="server">
    <h1 class="caption">
        <asp:Literal runat="server" ID="lttitle" Text="DANH SÁCH HỢP ĐỒNG"></asp:Literal></h1>
    <div id="msg">
    </div>
    <div id="details">
    </div>
    <div id="grid" style=" width:1855px;">
    </div>
    <div style="display:none" id ="kcpwindow">
    </div>
</asp:Content>
